package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class CustomSend extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_send);

        UpdateIpSelectCity updateIpSelectCity = new UpdateIpSelectCity();
        IntentFilter filter = new IntentFilter();
        filter.addAction(ActionUtils.ACTION_EQUES_UPDATE_IP);
        registerReceiver(updateIpSelectCity,filter);
    }

    public void sendAction1(View view) {
        Log.e("TAG", "sendAction2: -------------sendAction1" );
        Intent intent = new Intent();
        intent.setAction(ActionUtils.ACTION_EQUES_UPDATE_IP);
        sendBroadcast(intent);
        Log.e("TAG", "sendAction2: -----------=--sendAction1" );
    }
    ///静态发送
    public void sendAction2(View view) {
        Log.e("TAG", "sendAction2: -------------sendAction2" );
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        intent.setAction(ActionUtils.ACTION_FLAG);
        String className = getPackageName() + ".CustomReceiver";
        intent.setClassName(CustomSend.this, className);
        sendBroadcast(intent);
        Log.e("TAG", "sendAction2: -----------=--sendAction2" );

    }
}